package demo04_Singleton.LoadBalancer;

/**
 * 双重校验懒汉式
 */
public class DoubleCheckLazySingleon {

    private static volatile DoubleCheckLazySingleon instance = null;

    private DoubleCheckLazySingleon() {
    }

    public static DoubleCheckLazySingleon getInstance() {
        if(instance == null) {
            synchronized (DoubleCheckLazySingleon.class) {
                if(instance == null) {
                    instance = new DoubleCheckLazySingleon();
                }
            }
        }
        return instance;
    }

}
